package edu.sctu.practice.class02.yangshengyu.text01.test03;

/**
 * Created by Cullen on 2015/10/10.
 */
public class MyTime {
    private int hour;
    private int minute;
    private int second;

    public MyTime(int hour, int minute, int second) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
    }

    public void diaplay() {                //输出时间的方法
        int i = second % 60;
        minute = minute + second / 60;
        int j = minute % 60;
        hour = hour + minute / 60;
        System.out.println(hour + "小时" + j + "分钟" + i + "秒");
    }

    public static void main(String[] args) {
        MyTime myTime = new MyTime(0, 120, 98);
        myTime.diaplay();                   //打印时间

    }



    public void addSecond(int sec){
        this.second=second+sec;
    }

    public void addMinute(int min){
        this.minute=minute+min;
    }

    public void addHour(int hou){
        this.hour=hour+hou;
    }

    public void subSecond(int sec){
        this.second=second-sec;
    }

    public void subMinute(int min){
        this.minute=minute-min;
    }

    public void subHour(int hou){
        this.hour=hour-hou;
    }



}
